<!--
 * @Author: shuai
 * @Date: 2023-03-28 16:51:10
 * @LastEditors: shuai
 * @LastEditTime: 2023-03-29 16:00:37
 * @Description: file content
-->
<template>
  <Tettgen-echarts-com :option = option style="width: 100%;height: 400px;" ></Tettgen-echarts-com>
</template>

<script lang="ts" setup>
import { reactive } from 'vue'
import getData from './data3'
// echarts基础设置，例如标题，坐标轴等
const option = reactive(
  {
    title: {
      text: 'Referer of a Website',
      subtext: 'Fake Data',
      left: 'center'
    },
    tooltip: {
      trigger: 'item'
    },
    legend: {
      orient: 'vertical',
      left: 'left'
    }
  }
)
// 动态获取数据
getData().then(data => {
  console.log(111, data)
  Object.assign(option, {
    // dataset: { source: data }
    series: [
      {
        name: 'Access From',
        type: 'pie',
        radius: '50%',
        data,
        emphasis: {
          itemStyle: {
            shadowBlur: 10,
            shadowOffsetX: 0,
            shadowColor: 'rgba(0, 0, 0, 0.5)'
          }
        }
      }
    ]
  })
})
</script>

<style scoped lang="scss">

</style>
